package www.dashu.com.dao;

import www.dashu.com.dao.base.BaseDao;
import www.dashu.com.domain.SysPermission;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface SysPermissionDao extends BaseDao<SysPermission,Long> {

    @Query(value = "select o from SysPermission o where o.id =:id")
    List<SysPermission> getSysPermissionById(@Param("id") Long id);

    @Modifying
    @Query(value = "delete from SysPermission o where o.id = ?1")
    void deleteSysPermissionById(Long id);

    @Query(value = "select o from SysPermission o order by o.orderNum desc")
    List<SysPermission> findAllSort();
}